<template>
	<div id="app">
		111123123222222
		<input type="button" @click="addLink" value="添加链接">
		<input type="button" @click="addBook" value="添加book">
		<div id="editor" contenteditable="true" placeholder="写点什么吧，honey"></div>
	</div>
</template>

<script>
	import Editor from "sxyj-editor";

	export default {
		name: 'app',
		data () {
			return {
				editor: null
			}
		},
		mounted(){
			console.log( 222222, Editor );
			console.log( 333333, this.editor );

		},
		methods: {
			addLink(){
				this.editor.addLink( {
					url: 'http://m.sxyj.net/main/detail/1022864',
					name: '高冷总裁套路深',
					img: 'https://img.ireadercity.com/2017-10-09_1651113032cee997d.jpg'
				} );
			},
			addBook(){
				this.editor = new Editor( '#editor' );
				this.editor.addBook( {
					id: '9a1953d2955b4f65b21f6ea7e71483df',
					img: '//d.ireadercity.com/GoodBooks/Books/cover/2016-12-31/02ba27d6-339d-4cd2-8b2f-7949dac21de3.jpg',
					name: '穿暖花开',
					author: 'lingli',
					count: '10052',
					status: '1',
					price: '12',
					readNum: '1231',
					stars: 6,
					scoreNum: 123
				} );
			},
		}
	}
</script>

<style>
	* {
		margin: 0;
		padding: 0;
		list-style: none;
		outline: none;
	}

	#editor {
		border: 1px solid #ddd;
		height: 500px;
		width: 500px;
		margin: 50px;
	}
</style>
